package jjn.round2;

/**
 * @author Jiang Jining
 * @since 2023-05-02 23:54
 */
public class Offer53_MissingNumber {
    public int missingNumber(int[] nums) {
        int low = 0, high = nums.length - 1;
        while (low <= high) {
            int mid = (high - low) / 2 + low;
            if (nums[mid] == mid) {
                low = mid + 1;
            } else {
                high = mid - 1;
            }
        }
        return low;
    }
}
